package LuoGu.字符串处理.口算练习题;


import java.util.Scanner;
public class Main {
    public static void main(String [] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String index = "";
        for(int i=0;i<n;i++) {
            int a = 0;
            int b = 0;
            int c = 0;
            String temp = s.next();
            if(temp.equals("a")) {
                index = "a";
                a = s.nextInt();
                b = s.nextInt();
                c = a+b;
                temp = String.valueOf(a)+"+"+String.valueOf(b)+"="+String.valueOf(c);
                System.out.println(temp);
                System.out.println(temp.length());
            }else if(temp.equals("b")) {
                index = "b";
                a = s.nextInt();
                b = s.nextInt();
                c = a-b;
                temp = String.valueOf(a)+"-"+String.valueOf(b)+"="+String.valueOf(c);
                System.out.println(temp);
                System.out.println(temp.length());
            }else if(temp.equals("c")) {
                index = "c";
                a = s.nextInt();
                b = s.nextInt();
                c = a*b;
                temp = String.valueOf(a)+"*"+String.valueOf(b)+"="+String.valueOf(c);
                System.out.println(temp);
                System.out.println(temp.length());
            }else {
                a = Integer.valueOf(temp);
                b = s.nextInt();
                if(index.equals("a")) {
                    c = a+b;
                    temp = String.valueOf(a)+"+"+String.valueOf(b)+"="+String.valueOf(c);
                    System.out.println(temp);
                    System.out.println(temp.length());
                }else if(index.equals("b")) {
                    c = a-b;
                    temp = String.valueOf(a)+"-"+String.valueOf(b)+"="+String.valueOf(c);
                    System.out.println(temp);
                    System.out.println(temp.length());
                }else if(index.equals("c")) {
                    c = a*b;
                    temp = String.valueOf(a)+"*"+String.valueOf(b)+"="+String.valueOf(c);
                    System.out.println(temp);
                    System.out.println(temp.length());
                }
            }
        }
    }
}